/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 *
 * @author Administrator
 */
public class Account implements Serializable {

    public boolean canTransferTo(Account other) {
        return false;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Account)) {
            return false;
        }

        Account temp = (Account) o;
        if (temp.id.equals(temp.id)) {
            return true;
        }
        return false;

    }


    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the type
     */
    public AccountType getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(AccountType type) {
        this.type = type;
    }

    /**
     * @return the createDate
     */
    public Date getCreateDate() {
        return createDate;
    }

    /**
     * @param createDate the createDate to set
     */
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    /**
     * @return the balance
     */
    public BigDecimal getBalance() {
        return balance;
    }

    /**
     * @param balance the balance to set
     */
    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    /**
     * @return the psd
     */
    public String getPwd() {
        return pwd;
    }

    /**
     * @param psd the psd to set
     */
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public boolean deposit(BigDecimal amount) {
        this.balance = this.balance.add(amount);
        return true;
    }

    public boolean draw(BigDecimal amount) {
        this.balance = this.balance.subtract(amount);
        return true;
    }

    /**
     * @return the ownerID
     */
    public String getOwnerID() {
        return ownerID;
    }

    /**
     * @param ownerID the ownerID to set
     */
    public void setOwnerID(String ownerID) {
        this.ownerID = ownerID;
    }

    public enum AccountType {
        FIXED,
        CURRENT,
    }
    private String ownerID;
    private String id;
    private AccountType type;
    private Date createDate;
    private BigDecimal balance;
    private String pwd;
}
